Micron Document
Deavmi's coding shack


Displaying Rendered • View rawDownload

new_docs/content/documentation/oop.md 4f104ea5ebeb83e0201ca91abe676a955ac57a8c (4f104ea5) Text, 1.10 KB

title: OOP
description: Object-orientation support in T
date: 2021-05-31
tags: [oop, documentation]

OOP

Interfaces mmm How da fuq they get those lekker offsets

Classes

Single inheritance classes are supported in T and a basic class definition
for a class named T383838A looks as follows:

T282828
Tff7b72class Te6edf3A
Tb4b4b4{
T8b949e// Code goes here
Tb4b4b4}


Constructors

A constructor for our class T383838A is defined with a function named after the
class, so in this case that would be T383838A as shown below:

T282828
Tff7b72class Te6edf3A
Tb4b4b4{
Te6edf3ATb4b4b4(Tb4b4b4)
Tb4b4b4{
Tb4b4b4}
Tb4b4b4}


Destructors

Like a constructors, destructors follow the same syntax. However, destructors
have the tilde symbol, T383838~, infront of them like so:

T282828
Tff7b72class Te6edf3A
Tb4b4b4{
Tb4b4b4~Te6edf3ATb4b4b4(Tb4b4b4)
Tb4b4b4{
Tb4b4b4}
Tb4b4b4}


Destructors run when you use the T383838delete keyword on an object reference.


Inheritance

Classes in T support single inheritance using the T383838: operator. Below we
have a base class A and a sub-class B. The syntax is as follows:

Class A:

T282828
Tff7b72class Te6edf3A
Tb4b4b4{
Tb4b4b4}


Class B (which inherits from A):

T282828
Tff7b72class Te6edf3B Tb4b4b4: Te6edf3A
Tb4b4b4{
Tb4b4b4}


Interfaces

TODO: Interfaces

Served by rngit 1.5.0 - Generated in 0.07s